<%@ page pageEncoding="utf-8" contentType="text/html" %>
<%@ page import="model.*"%>
<%
Object[] grouplist = (Object[]) request.getAttribute("grouplist[]");
int[] permissions = UserGroup.getAllPermissions();
%>

<%@ include file="header.tpl.jsp"%>

<style type="text/css">
.current td{font-weight:bold;}
</style>

<div class="box list">
	<h2>用户组列表</h2>
	<table>
		<thead>
			<tr>
				<td rowspan="2">用户组名</td>
				<td colspan="8">权限</td></tr>
			<tr>
				<td>回答题目</td>
				<td>添加题目</td>
				<td>编辑题目</td>
				<td>删除问题</td>
				<td>添加试卷</td>
				<td>编辑试卷</td>
				<td>删除试卷</td>
				<td>更改问题类型</td>
			</tr>
		</thead>
		<tbody>
		<%for(int i = 0; i < grouplist.length; i++){%>
		<%UserGroup g = (UserGroup) grouplist[i]; %>
			<tr<%if(user.getGroupId() == g.getGroupId()){%> class="current"<%}%>>
				<td><%=g.getGroupName()%></td>
				<%for(int j = 0; j < permissions.length; j++){%>
				<td><%=g.hasPermission(permissions[j]) ? "是" : "否"%></td>
				<%}%>
			</tr>
		<%}%>
		</tbody>
	</table>
</div>

<%@ include file="footer.tpl.jsp"%>